<?php

/**
 * This is the model class for table "worker_bankcash".
 *
 * The followings are the available columns in table 'worker_bankcash':
 * @property string $bankcash_id
 * @property string $worker_id
 * @property string $type
 * @property double $amount
 * @property double $balance
 * @property double $balance_withdrawing
 * @property double $balacan_cash
 * @property double $income_platform
 * @property double $income_purse
 * @property double $income_order
 * @property double $fee
 * @property string $remark
 * @property integer $is_delete
 * @property string $create_time
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 * @property string $mobile
 */
class WorkerBankcash extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return WorkerBankcash the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'worker_bankcash';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('worker_id, type', 'required'),
			array('is_delete', 'numerical', 'integerOnly'=>true),
			array('amount, balance, balance_withdrawing, balacan_cash, income_platform, income_purse, income_order, fee', 'numerical'),
			array('worker_id', 'length', 'max'=>64),
			array('type, remark, created_by, updated_by, mobile', 'length', 'max'=>255),
			array('create_time, update_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('bankcash_id, worker_id, type, amount, balance, balance_withdrawing, balacan_cash, income_platform, income_purse, income_order, fee, remark, is_delete, create_time, update_time, created_by, updated_by, mobile', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'bankcash_id' => 'Bankcash',
			'worker_id' => 'Worker',
			'type' => 'Type',
			'amount' => 'Amount',
			'balance' => 'Balance',
			'balance_withdrawing' => 'Balance Withdrawing',
			'balacan_cash' => 'Balacan Cash',
			'income_platform' => 'Income Platform',
			'income_purse' => 'Income Purse',
			'income_order' => 'Income Order',
			'fee' => 'Fee',
			'remark' => 'Remark',
			'is_delete' => 'Is Delete',
			'create_time' => 'Create Time',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
			'mobile' => 'Mobile',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('bankcash_id',$this->bankcash_id,true);
		$criteria->compare('worker_id',$this->worker_id,true);
		$criteria->compare('type',$this->type,true);
		$criteria->compare('amount',$this->amount);
		$criteria->compare('balance',$this->balance);
		$criteria->compare('balance_withdrawing',$this->balance_withdrawing);
		$criteria->compare('balacan_cash',$this->balacan_cash);
		$criteria->compare('income_platform',$this->income_platform);
		$criteria->compare('income_purse',$this->income_purse);
		$criteria->compare('income_order',$this->income_order);
		$criteria->compare('fee',$this->fee);
		$criteria->compare('remark',$this->remark,true);
		$criteria->compare('is_delete',$this->is_delete);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);
		$criteria->compare('mobile',$this->mobile,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}